/*
 * Socket.h
 *
 *  Created on: 23/05/2012
 *      Author: sebastian
 */

#ifndef SOCKET_H_
#define SOCKET_H_

#define MAX_CON 5

#include <string>

class Socket {
public:
	explicit Socket(const char* ports);
	Socket(const char* ports, int sockfd);
	virtual ~Socket();
	void enlazar();
	void cerrar();
	int aceptar();
	int conectar(std::string dir);
	void escuchar();
	int enviar(int clientfd, std::string data);
	int enviar(std::string data);
	int recibir(char* buf, unsigned int size);
	int recibir(int clientfd, char* buf, unsigned int size);
	int getFd();
private:
	int sockfd;
	int puerto;
};

#endif /* SOCKET_H_ */
